package island.gotenyama.beans;

import org.apache.pivot.wtk.TextInput;

public class PlanBindMapping implements TextInput.TextBindMapping {

	@Override
	public String toString(Object value) {
		if (value != null) {
			return value.toString();
		} else {
			return "";
		}
	}

	@Override
	public Object valueOf(String text) {
		// in case of an empty string to validate, return a default value, to avoid an NPE
		if (text == null || text.equals("")) {
			return "";
		}
		return Integer.parseInt(text);
	}
}
